﻿using MediatR;
using T.Vehicleservice.API.Application.Command.ExpenseCommand;
using T.Vehicleservice.API.Application.Command.MainCommand;
using T.Vehicleservice.Repository.ImpI;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.API.Application.CommandHandlers.ExpenseCommanHandler
{
    public class ExpenseUpdateCommandHandler : IRequestHandler<ExpenseUpdateCommand, int>
    {
        IExpenseRecordRepository expenseRecordRepository;

        public ExpenseUpdateCommandHandler(IExpenseRecordRepository expenseRecordRepository)
        {
            this.expenseRecordRepository = expenseRecordRepository;
        }

        public async Task<int> Handle(ExpenseUpdateCommand request, CancellationToken cancellationToken)
        {
            return await expenseRecordRepository.UpdateAsync(request);
        }
    }
}
